<?php 
//Hàm print: in chuỗi ra màn hình nhưng không xuống dòng
print "<strong>Single-quoted strings</strong>"."<br>";
print 'I have gone to the store.'.'<br>';	//Để cộng chuỗi, sử dụng dấu .
print 'I\'ve gone to the store.';	//Hiển thị dấu '
print 'Would you pay $1.75 for 8 ounces of tap water?';
print 'In double-quoted strings, newline is represented by \n';	//Với dấu '', \n không tạo ra dòng mới

//Double-quoted strings
print '<br>'.'<br>'.'<br>'."<strong>Double-quoted strings</strong>"."<br>";
print "I've gone to the store.";
print "The sauce cost \$10.25";
$cost = '10.25';		//Khai báo biến trong PHP
print "The sauce cost $cost.";		//In chuỗi chứa giá trị biến
print "The sauce cost \$\061\060.\x32\x35.";	//the character is ASCII code 49 decimal and 061 octal.

//Double-quoted strings
print '<br>'.'<br>'.'<br>'."<strong>Heredoc -specified strings</strong>"."<br>";
//Về cơ bản vẫn giống với print, nhưng tiện hơn rất nhiều. Tuy nhiên, không tự động xuống dòng như trong các tài liệu hướng dẫn (nhưng không sao!)
print <<<END
It's funny when signs say things like:
Original "Root" Beer
"Free" Gift
Shoes cleaned while "you" wait
or have other misquoted words.
END;
?>

<?php print <<< PARSLEY
<br>It's easy to grow fresh:
Parsley
Chives
on your windowsill
PARSLEY;
print <<<DOGS
If you like pets, yell out:
DOGS AND CATS ARE GREAT!
DOGS;
?>

<?php
$name = "Joe Smith";
$occupation = "Programmer";
echo <<< EOF
<br>This is a heredoc section.
For more information talk to <strong>$name</strong>, your local <i>$occupation</i>.
Thanks!
EOF;
$toprint = <<< EOF
<br>
<div>Hey $name! You can actually assign the heredoc section to a variable!</div>
EOF;
echo $toprint; 
?>

<?php
$remaining_cards = 0;
if ($remaining_cards > 0) {
	$url = "/deal.php";
	$text = 'Deal more cards';
}else {
	$url = "/new-game.php";
	$text = 'Start a new game';
}
print <<< HTML
<br>There are <b>$remaining_cards</b> left.
<p><a href="$url">$text</a>
HTML
?>
<?php //In some cases, however, you shouldn’t use the semicolon.
$divClass = 'class1';
$ulClass = 'class2';
$listItem = 'The List Item';
$html = <<< END
<div class='$divClass'>
	<ul class='$ulClass'>
		<li>
END
.$listItem.'</li></div>';
print $html;
?>
